package my.diplom.dao.service;

import my.diplom.dao.IMessageDAO;
import my.diplom.entity.Message;
import my.diplom.entity.User;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: gb
 * Date: 14.07.2009
 * Time: 17:24:59
 * To change this template use File | Settings | File Templates.
 */
public class MessageService {

    private IMessageDAO messageDAO;


    public IMessageDAO getMessageDAO() {
        return messageDAO;
    }

    public void setMessageDAO(IMessageDAO messageDAO) {
        this.messageDAO = messageDAO;
    }

    public void create(Message message) {
        messageDAO.create(message);
    }

    public void update(Message message) {
        messageDAO.update(message);
    }

    public Message getById(Long messageId) {
        return messageDAO.getById(messageId);
    }

    public List<Message> getAll() {
        return messageDAO.getAll();
    }

    public void delete(Message message) {
        messageDAO.delete(message);
    }

    public List<Message> getReceivedByUser(User user) {
        return messageDAO.getReceivedByUser(user);
    }

    public List<Message> getSentByUser(User user) {
        return messageDAO.getSentByUser(user);
    }
}
